package com.sui.bigdata.flink.sql.function.scalar;

import org.apache.flink.table.functions.ScalarFunction;
import com.sui.bigdata.flink.sql.function.util.RiskAES;

/**
 * @author YongChen
 * @date 2019/11/26 10:18
 * @description
 * @email yong_chen@sui.com
 */
public class RiskDecrypt extends ScalarFunction {
    private static final String ENCRYPT_USER_SALT = "&*($eIa61M$(&^%M";

    public static String eval(String str){
        if (str == null) {
            return null;
        }
        try {
            return RiskAES.base64AndDecrypt(str, ENCRYPT_USER_SALT);
        } catch (Exception e) {
            return null;
        }

    }

    public static void main(String[] args) {
        System.out.println(RiskDecrypt.eval("JaSfiX3QNm3BCTSHNAicfWc9xG4ZgLegLVTYIR511b4="));
    }
}
